<?php
/**
 * paypal接口类
 */
class Bank{

    public $lastError; //Holds the last error encountered

    public $logIpn;//Do we need to log IPN results ?

    public $ipnLogFile;//File to log IPN results

    public $ipnResponse;//Payment gateway IPN response

    public $testMode;//Are we in test mode ?

    public $fields = array();//Field array to submit to gateway

    public $ipnData = array();//IPN post values as array

    public $gatewayUrl;//Payment gateway URL

    public function addField($field, $value){
        $this->fields["$field"] = $value;
    }

    /**
    * 生成支付代码
    * @param   array   $order      订单信息
    * @param   array   $payment    支付方式信息
    */
    function getCode($order,$payment){
       
		$str ='';
		$str.=$this->gatewayUrl;
    	return $str;
	}

   
	public function __construct($payment){
       
		$this->gatewayUrl = $payment['gateway'];
		
	}


    /*支付处理页面*/
	public function notify($order,$payment){//异步调用该方法
		
		
	}

	/*
	*支付返回处理
	*@param $base 网站url根路劲
	*@param $s 成功提示信息
	*@param $f 失败提示信息
	*@return Array
	*/
	function returnUrl($order,$payment){
		
	}

	/*处理订单成功*/
    function successDb($orderNo,$flag){
		$model = D("Order");
		$maps['orderno'] = $orderNo;
		$data['status']   = $flag;
		
		$model->where($maps)->save($data);
    }

	/*处理订单失败*/
    function failureDb($orderNo,$flag){

        $model = D("Order");
		$maps['orderno'] = $orderNo;
		$data['status']   = $flag;
		
		$model->where($maps)->save($data);
    }

}
?>
